import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        // {
        //     path:'/',
        //     redirect:'/index'
        // },
        {
            path:'/index',
            component:()=>import('@/pages/index'),
            children:[
                {
                    path:'/floor',
                    component:()=>import('@/pages/floor')
                },
                {
                    path:'/first',
                    component:()=>import('@/pages/first')
                }
            ]
        }
    ]
})

// router.beforeEach((to, from, next) => {
//     if (to.path == "/login") {
//         next()
//     } else {
//         let token = sessionStorage.getItem("token")
//         let time = sessionStorage.getItem("time")
//         if (token) {
//             if (new Date(Number(time)+60*1000)<new Date()){
//                 next("/login")
//             }else{
//                 next()
//             }
//         } else {
//             next('/login')
//         }
//     }
// })



export default router